<%@ page language="java" import="java.util.*,com.fescoservice.model.*" pageEncoding="UTF-8"%>

<%
	String langfilename = "/resources/message";
	String serchOptionSel =  request.getAttribute("SerchOptionSel")==null?"":(String)request.getAttribute("SerchOptionSel");
	String serchOptionValue =  request.getAttribute("SerchOptionValueSel")==null?"":(String)request.getAttribute("SerchOptionValueSel");
	String creatorDept =  request.getAttribute("creatorDept")==null?"":(String)request.getAttribute("creatorDept");
	String custId =  request.getAttribute("custId")==null?"":(String)request.getAttribute("custId");
	
	String companyId =  request.getAttribute("companyId")==null?"":(String)request.getAttribute("companyId");
	String companyName =  request.getAttribute("companyName")==null?"":(String)request.getAttribute("companyName");
	String companyAddr =  request.getAttribute("companyAddr")==null?"":(String)request.getAttribute("companyAddr");
	Application apply =  (Application)request.getAttribute("application");
%>
<%@include file="../common/LocaleManager.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Fesco Service</title>
		<link rel="stylesheet" href="<%=path%>/js/jquery/themes/redmond/jquery.ui.all.css">
		<script src="<%=path%>/js/jquery/jquery-1.5.1.js"></script>
		<script src="<%=path%>/js/FormCheck.js"></script>
		<script src="<%=path%>/js/common.js"></script>
	    <script src="<%=path%>/js/resources_zh_CN.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.datepicker.js"></script>			
		<script src="<%=path%>/js/jquery/external/jquery.bgiframe-2.1.2.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.widget.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.datepicker.js"></script>	
		<script src="<%=path%>/js/jquery/ui/jquery.ui.mouse.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.button.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.draggable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.position.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.resizable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.slide.js"></script>
		<link rel="stylesheet" href="<%=path%>/css/admin.css">
	
		<style type="text/css">
		
		</style>
		<script type="text/javascript">
			$(function() {
				
				$( "#finifhDate" ).datepicker({
					changeMonth: true,
					changeYear: true
				 });
				 $( "#preDate" ).datepicker({
					changeMonth: true,
					changeYear: true
				 });
				 
				 $( "#payDate" ).datepicker({
						changeMonth: true,
						changeYear: true
				 });
				 
				$("#btnAdd").button().click(function() {		
					
					//验空
					if (!check_empty("mainForm.applyKey|finifhDate|fee|serviceCost|preDate|hrId|serviceNumber|applyType|applyArea","<%=resource.getString("FS_T_APPLICATION_APPLY_KEY")%>|<%=resource.getString("FS_T_APPLICATION_FINISH_DATE")%>|<%=resource.getString("FS_T_APPLICATION_FEE")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>|<%=resource.getString("FS_T_APPLICATION_PRE_DATE")%>|<%=resource.getString("FS_T_APPLICATION_HR_ID")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_NUMBER")%>|<%=resource.getString("FS_T_APPLICATION_APPLY_TYPE")%>||<%=resource.getString("FS_T_APPLICATION_APPLY_AREA")%>"))
						return false;
					
					//验长度
					if (!check_length_zhCN("mainForm.fee|serviceCost|hrId|serviceNumber|memo","10|10|40|30|400"," <%=resource.getString("FS_T_APPLICATION_FEE")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>|<%=resource.getString("FS_T_APPLICATION_HR_ID")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_NUMBER")%>|<%=resource.getString("FS_T_APPLICATION_MEMO")%>")){
					    return false;
					}

					//检查数字
					if (!check_number("mainForm.fee|serviceCost","<%=resource.getString("FS_T_APPLICATION_FEE")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>")){
						return false;
					}
					
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=modifyApplication';
					document.forms.mainForm.submit();		
				});
				$("#btnBack").button().click(function() {
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=viewCustomer';
					document.forms.mainForm.submit();		
				});
				
				$("#btnDelete").button().click(function() {
					if(confirm("<%=resource.getString("FS_T_CONFIRMDELETE")%><%=resource.getString("FS_T_APPLICATION")%><%=resource.getString("FS_T_ASKSUFFIX")%>")){
						
						document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=deleteApplication';
						//document.forms.mainForm.type.value=""
						document.forms.mainForm.submit();		
					}
				});
			});

		</script>
	</head>
	<body>
		
		<div class="wrapContent">	
			<div class="ui-widget">	
				<div class="ui-widget-header">
					<%=resource.getString("FS_T_MODIFY")%><%=resource.getString("FS_T_APPLICATION")%>
				</div>
				<div class="ui-widget-content operatorForm">
					<form name="mainForm" method="post">
						<fieldset >
							<label for="applyKey">
								<%=resource.getString("FS_T_APPLICATION_APPLY_KEY")%>
							</label>
							<input type="hidden" name="custId" class=" ui-corner-all" value="<%=apply.getCustId() %>" />	
							<input type="hidden" name="applyId" class=" ui-corner-all" value="<%=apply.getApplyId() %>" />	
							
							<input id="companyId" name="companyId" class=" ui-corner-all" type="hidden"  value="<%=companyId %>" />	
							<input id="companyName" name="companyName" class=" ui-corner-all" type="hidden"  value="<%=companyName %>" />	
							<input id="companyAddr" name="companyAddr" class=" ui-corner-all" type="hidden"  value="<%=companyAddr %>" />	
							
							<% if("1".equals(creatorDept)){%> 
							    <select name="applyKey" id="applyKey" class=" ui-corner-all">				
									<option value="A" <% if("A".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_WORK_AUTH")%></option>
									<option value="B" <% if("B".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_VISA_INVITATION")%></option>
									<option value="C" <% if("C".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_WORK")%></option>
									<option value="D" <% if("D".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_LIVE_AUTH")%></option>
									<option value="E" <% if("E".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_WORK_DELAY")%></option>
								</select>
							
							<% }%>
							<% if("2".equals(creatorDept)){%> 
							    <select name="applyKey" id="applyKey" class=" ui-corner-all">				
									<option value="F" <% if("F".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_DRIVE")%></option>
								</select>
							
							<% }%>
							<% if("3".equals(creatorDept)){%> 
							    <select name="applyKey" id="applyKey" class=" ui-corner-all">				
									<option value="G" <% if("G".equals(apply.getApplyKey())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_KEY_ABORD")%></option>
								</select>							
							<% }%>
						</fieldset>
						
						<fieldset>
							<label for="finifhDate">
								<%=resource.getString("FS_T_APPLICATION_FINISH_DATE")%>
							</label>
							<input type="hidden" name="SerchOptionSel" class=" ui-corner-all" value="<%=serchOptionSel %>" />	
							<input type="hidden" name="SerchOptionValueSel" class=" ui-corner-all" value="<%=serchOptionValue %>" />
							<input id="finifhDate" name="finifhDate" class=" ui-corner-all" type="text" value = "<%=apply.getFinifhDate() %>" readOnly="true"/> <br>										
						</fieldset>
						
						<fieldset >
							<label for="fee">
								<%=resource.getString("FS_T_APPLICATION_FEE")%>
							</label>
							<input type="text" name="fee" class=" ui-corner-all" value="<%=apply.getFee() %>" maxlength = "10"  />
						</fieldset>

						
						<fieldset >
							<label for="serviceCost">
								<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>
							</label>
							<input id="serviceCost" type="text" name="serviceCost" class=" ui-corner-all" value="<%=apply.getServiceCost() %>" maxlength = "10"  />
						</fieldset>
						
						
						<fieldset >
							<label for="preDate">
								<%=resource.getString("FS_T_APPLICATION_PRE_DATE")%>
							</label>
							<input id="preDate" name="preDate" class=" ui-corner-all" type="text" value="<%=apply.getPreDate() %>" readOnly="true"/> <br>
						</fieldset>
						
						<fieldset >
							<label for="payDate">
								<%=resource.getString("FS_T_APPLICATION_PAY_DATE")%>
							</label>
							<input id="payDate" name="payDate" class=" ui-corner-all" type="text" value="<%=apply.getPayDate() %>" readOnly="true"/> <br>
						</fieldset>
						
						<fieldset >
							<label for="hrId">
								<%=resource.getString("FS_T_APPLICATION_HR_ID")%>
							</label>
							<input id="hrId" type="text" name="hrId" class=" ui-corner-all" value="<%=apply.getHrId()%>" maxlength = "40"  />
						</fieldset>
					
						<fieldset >
							<label for="serviceNumber">
								<%=resource.getString("FS_T_APPLICATION_SERVICE_NUMBER")%>
							</label>
							<input id="serviceNumber" type="text" name="serviceNumber" class=" ui-corner-all" value="<%=apply.getServiceNumber()%>" maxlength = "30"  />
						</fieldset>
						<fieldset >
							<label for="applyType">
								<%=resource.getString("FS_T_APPLICATION_APPLY_TYPE")%>
							</label>
							<select name="applyType" id="applyType" class=" ui-corner-all">				
								<option value="1" <% if("1".equals(apply.getApplyType())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLY_FIRST")%></option>
								<option value="2" <% if("2".equals(apply.getApplyType())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLY_CONTINUE")%></option>
							</select>			
						</fieldset>
						
						<fieldset >
							<label for="status">
								<%=resource.getString("FS_T_APPLICATION_STATUS")%>
							</label>
							<select name="status" id="status" class=" ui-corner-all">				
								<option value="1" <% if("1".equals(apply.getStatus())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_OPER_STATUS_NOT")%></option>
								<option value="2" <% if("2".equals(apply.getStatus())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_OPER_STATUS_ING")%></option>
								<option value="3" <% if("3".equals(apply.getStatus())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_OPER_STATUS_FINISH")%></option>
							</select>			
						</fieldset>

						<fieldset >
							<label for="applyArea">
								<%=resource.getString("FS_T_APPLICATION_APPLY_AREA")%>
							</label>
							<select name="applyArea" id="applyArea" class=" ui-corner-all">				
								<option value="1" <% if("1".equals(apply.getApplyArea())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_1")%></option>
								<option value="2" <% if("2".equals(apply.getApplyArea())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_2")%></option>
								<option value="3" <% if("3".equals(apply.getApplyArea())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_3")%></option>
								<option value="4" <% if("4".equals(apply.getApplyArea())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_4")%></option>
							</select>				
						</fieldset>
					
						
						
									<!-- 	
						
						<fieldset >
							<label for="feeStatus">
								<%=resource.getString("FS_T_APPLICATION_FEE_STATUS")%>
							</label>
							<select name="feeStatus" id="feeStatus" class=" ui-corner-all">				
								<option value="1" <% if("1".equals(apply.getFeeStatus())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_FEE_STATUS_NOT")%></option>
								<option value="2" <% if("2".equals(apply.getFeeStatus())){%> selected="selected"	<% }%>><%=resource.getString("FS_T_APPLICATION_FEE_STATUS_FINISH")%></option>
							</select>			
						</fieldset>
						 -->	

						<fieldset >
							<label for="memo">
								<%=resource.getString("FS_T_APPLICATION_MEMO")%>
							</label>
							<input id="memo" type="text" name="memo" class=" ui-corner-all" value="<%=apply.getMemo()%>" maxlength = "400"  />
						</fieldset>
					</form>	
					<div class="clear"></div>
				</div>			
				<div class="buttonGroupRight">
			   		<div id="btnAdd" ><%=resource.getString("FS_T_SAVE")%></div>
			   		<div id="btnDelete" ><%=resource.getString("FS_T_DELETE")%></div>
					<div id="btnBack" ><%=resource.getString("FS_T_LIST")%></div>
				</div>		
			</div>
		</div>
		<div id="companyList" >
		
		</div>
		<script type="text/javascript"	>	
		//import scripts below to pages which display in right frame, for ajust the scroll height
		parent.scroll(0,0);
		parent.setFrameHeight(document.body.scrollHeight+200);
		</script>
	</body>
</html>